<!--查询所有学生成绩-->
<template>
  <el-container>
    <el-header>
      <h1>查询所有学生成绩</h1>
    </el-header>
    <el-main>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="username" label="学生名称"/>
        <el-table-column prop="subjects" label="科目"/>
        <el-table-column prop="results" label="成绩"/>
        <el-table-column label="所属班级" prop="grade"/>
        <el-table-column label="创建时间" prop="data">
          <template #default="data">
            <span>{{ DateJudge(data.row.data) }}</span>
          </template>
        </el-table-column>
      </el-table>
    </el-main>
  </el-container>
</template>

<script>
import {request} from "@/network/request";
import {DateJudge} from "@/components/function/DateJudge";

export default {
  name: "ListResults",
  data() {
    return {
      tableData: null
    }
  },
  mounted() {
    this.demo();
  },
  methods: {
    DateJudge,
    demo() {
      request({
        url: '/login/showallresults'
      }).then(res => {
        if (res.data.success) {
          this.$data.tableData = res.data.data
        } else {
          this.$message({
            type: 'warning',
            message: res.data.message
          })
        }
      }).catch(err => {
        this.$message({
          type: 'warning',
          message: '数据错误' + err
        })
      })
    }
  }
}
</script>

<style scoped>

</style>